magazine$pretime2mon <- as.Date(magazine$pretime2mon)
magazine$posttime2mon <- as.Date(magazine$posttime2mon)
# merge propaganda and violence
magazine <- merge(magazine, reformed,
by = c("group", "pretime3mon", "pretime2mon", "time"), all.x = TRUE)
magazine <- merge(magazine, reformedpost,
by = c("group", "posttime2mon", "time"), all.x = TRUE)
# calculate aggregated variables
magazine_agg <- magazine %>%
group_by(group, pretime3mon, pretime2mon, time, type, language, magazine, issue, women, rawtime, total_issue, year, competitors) %>%
summarize(religscore = mean(religscore, na.rm = TRUE),
posscore = mean(posscore, na.rm = TRUE),
pagenum = max(as.numeric(gsub(".txt", "", page))))
magazine <- merge(magazine, magazine_agg[,c("group", "magazine", "issue", "language", "pagenum")], by = c("group", "magazine", "issue", "language"), all.x = TRUE)
### transform violent variables
magazine$logtotaldeaths3mon <- log(magazine$totaldeaths3mon + 1)
magazine$logstatebased3mon <- log(magazine$statebased3mon + 1)
magazine$logtotalevent3mon <- log(magazine$totalevent3mon + 1)
magazine$logtotaldeaths2mon <- log(magazine$totaldeaths2mon + 1)
magazine$logstatebased2mon <- log(magazine$statebased2mon + 1)
magazine$logtotalevent2mon <- log(magazine$totalevent2mon + 1)
magazine$logcivildeaths2mon <- log(magazine$civildeaths2mon + 1)
magazine$logtotaldeaths2monpost <- log(magazine$totaldeaths2monpost + 1)
magazine$logstatebased2monpost <- log(magazine$statebased2monpost + 1)
magazine$logtotalevent2monpost <- log(magazine$totalevent2monpost + 1)
write.csv(magazine, "../datasets/1_magazine.csv", row.names=FALSE)
View(magazine)
View(magazine)
View(magazine[,c("page", "pagenum")])
magazine <- read.csv("../datasets/1_magazine.csv", stringsAsFactors = FALSE)
### Main Text Table 1: Military Power and Religiosity Score in Magazines
mod1 <- feols(religscore ~ logtotalevent2mon + women + frontpage + total_issue + competitors |
language + year, data = magazine[magazine$type %in% c("Magazine"),])
mod1cl <- summary(mod1, cluster = ~issue)
mod1fe <- feols(religscore ~ logtotalevent2mon + women + frontpage + total_issue |
group + language + year,
data = magazine[magazine$type %in% c("Magazine"),])
mod1fecl <- summary(mod1fe, cluster = ~issue)
mod2 <- feols(religscore ~ logtotaldeaths2mon + women + frontpage + total_issue + competitors |
language + year, data = magazine[magazine$type %in% c("Magazine"),])
mod2cl <- summary(mod2, cluster = ~issue)
mod2fe <- feols(religscore ~ logtotaldeaths2mon + women + frontpage + total_issue |
group + language + year,
data = magazine[magazine$type %in% c("Magazine"),])
mod2fecl <- summary(mod2fe, cluster = ~issue)
mod3 <- feols(religscore ~ logstatebased2mon + women + frontpage + total_issue + competitors |
language + year, data = magazine[magazine$type %in% c("Magazine"),])
mod3cl <- summary(mod3, cluster = ~issue)
mod3fe <- feols(religscore ~ logstatebased2mon + women + frontpage + total_issue |
group + language + year,
data = magazine[magazine$type %in% c("Magazine"),])
mod3fecl <- summary(mod3fe, cluster = ~issue)
mod1noisis <- feols(religscore ~ logtotalevent2mon + women + frontpage + total_issue + competitors |
language + year,
data = magazine[magazine$group != "Islamic State" &
magazine$type %in% c("Magazine"),])
mod1clnoisis <- summary(mod1noisis, cluster = ~issue)
mod1fenoisis <- feols(religscore ~ logtotalevent2mon + women + frontpage + total_issue |
group + language + year,
data = magazine[magazine$group != "Islamic State" &
magazine$type %in% c("Magazine"),])
mod1feclnoisis <- summary(mod1fenoisis, cluster = ~issue)
texreg(list(mod1cl, mod1fecl, mod2cl, mod2fecl, mod3cl, mod3fecl, mod1clnoisis, mod1feclnoisis), stars = c(0.05))
stargazer::stargazer(mod3fecl)
mod3fecl
install.packages("broom")
install.packages("broom")
library(broom)
texreg(list(mod1cl, mod1fecl, mod2cl, mod2fecl, mod3cl, mod3fecl, mod1clnoisis, mod1feclnoisis), stars = c(0.05))
library(dplyr)
library(fixest)
library(stargazer)
library(texreg)
texreg(list(mod1cl, mod1fecl, mod2cl, mod2fecl, mod3cl, mod3fecl, mod1clnoisis, mod1feclnoisis), stars = c(0.05))
magazine <- read.csv("../datasets/1_magazine.csv", stringsAsFactors = FALSE)
colnames(magazine)
#######################################################################
##### This file replicates the first study (twitter) in the paper #####
#######################################################################
rm(list = ls())
library(data.table)
library(dplyr)
library(fixest)
library(lfe)
library(lmtest)
library(MASS)
library(plm)
library(sandwich)
library(stargazer)
library(texreg)
orgtweet <- fread("../datasets/1_twitter_tweets.csv", stringsAsFactors = FALSE)
### keep only original tweets
orgtweet <- orgtweet[is.na(orgtweet$in_reply_to_status_id),]
colnames(orgtweet)
head(orgtweet$text_en)
\
panel <- read.csv("../datasets/1_twitter_panel.csv", stringsAsFactors = FALSE)
colnames(panel)
colnames(orgtweet)
### keep only original tweets
orgtweet <- orgtweet[is.na(orgtweet$in_reply_to_status_id),]
orgtweet <- orgtweet[,c("created_date", "tweet_id", "created_time", "user_id",
"screen_name", "user_created_time", "user_created_date", "followers_count",
"favourites_count", "friends_count", "statuses_count", "location",
"time_zone", "hashtags", "media",
"urls", "mentions_ids", "mentions_screen_names",
"retweet_id", "retweet_count", "retweet_user_followers",
"retweet_user_id", "retweet_user_screen_name", "retweet_location",
"daystoholi", "mentioncore", "mentionmember",  "mentiontotal",
"all_retweet", "members_retweet", "core_retweet", "core_retweet2",
"geo_retweet", "geo_core_retweet1", "geo_core_retweet2", "daily_active_user",
"daily_avg_followers", "daily_active_core", "daily_herf", "territory",
"territory_lag_10", "totalevent1", "statebased1", "totaldeaths1", "religscore")]
write.csv(orgtweet, "../datasets/1_twitter_tweets.csv", row.names = FALSE)
orgtweet <- fread("../datasets/1_twitter_tweets.csv", stringsAsFactors = FALSE)
## calculate variables
class(orgtweet$user_created_date)
orgtweet$accountlength <- as.Date("2015-12-31") - as.Date(orgtweet$user_created_date)
orgtweet$mentionout <- orgtweet$mentiontotal - orgtweet$mentionmember
orgtweet$Imentionout <- ifelse(orgtweet$mentionout >= 1, 1, 0)
orgtweet$Ihashtags <- ifelse(orgtweet$hashtags=="[]", 0, 1)
orgtweet$Ireply <- ifelse(is.na(orgtweet$in_reply_to_status_id), 0, 1)
orgtweet$daily_core_prop <- orgtweet$daily_active_core/orgtweet$daily_active_user
orgtweet$ff <- orgtweet$family + orgtweet$friend
orgtweet$mobilization <- orgtweet$family + orgtweet$affiliation
colnames(orgtweet)
#######################################################################
##### This file replicates the first study (twitter) in the paper #####
#######################################################################
rm(list = ls())
library(data.table)
library(dplyr)
library(fixest)
library(lfe)
library(lmtest)
library(MASS)
library(plm)
library(sandwich)
library(stargazer)
library(texreg)
orgtweet <- fread("../datasets/1_twitter_tweets.csv", stringsAsFactors = FALSE)
## calculate variables
class(orgtweet$user_created_date)
orgtweet$accountlength <- as.Date("2015-12-31") - as.Date(orgtweet$user_created_date)
orgtweet$mentionout <- orgtweet$mentiontotal - orgtweet$mentionmember
orgtweet$Imentionout <- ifelse(orgtweet$mentionout >= 1, 1, 0)
orgtweet$Ihashtags <- ifelse(orgtweet$hashtags=="[]", 0, 1)
orgtweet$Ireply <- ifelse(is.na(orgtweet$in_reply_to_status_id), 0, 1)
orgtweet$daily_core_prop <- orgtweet$daily_active_core/orgtweet$daily_active_user
colnames(orgtweet)
orgtweet$ff <- orgtweet$family + orgtweet$friend
head(orgtweet$family)
head(orgtweet$ff)
all(is.na(orgtweet$family))
head(orgtweet$accountlength)
head(orgtweet$mentionout)
head(orgtweet$Imentionout)
head(orgtweet$Ihashtags)
head(orgtweet$Ireply)
head(orgtweet$daily_core_prop)
### Appendix Table A8: Summary Statistics for Twitter Analyses
colnames(orgtweet)
# [1:6] is for removing the NA column
sumstats <- rbind(round(summary(orgtweet$religscore)[1:6], 3),
round(summary(orgtweet$territory_lag_10)[1:6], 3),
round(summary(orgtweet$daystoholi)[1:6], 3),
round(summary(orgtweet$followers_count)[1:6], 3),
round(summary(orgtweet$favourites_count)[1:6], 3),
round(summary(orgtweet$friends_count)[1:6], 3),
round(summary(orgtweet$statuses_count)[1:6], 3),
round(summary(as.numeric(orgtweet$accountlength))[1:6], 3),
round(summary(orgtweet$media)[1:6], 3),
round(summary(orgtweet$urls)[1:6], 3),
round(summary(orgtweet$Ihashtags)[1:6], 3))
row.names(sumstats) <- c("Religiosity Score", "Territory", "Days to Islamic Holidays", "Followers Count",
"Favorites Count", "Friends Count", "Statuses Count", "Account Length", "Media", "Urls", "Hashtags")
stargazer(sumstats, summary = FALSE)
### transform variables
orgtweet$territory <- orgtweet$territory/100
orgtweet$daystoholi <- orgtweet$daystoholi/10000
orgtweet$accountlength <- orgtweet$accountlength/10000
orgtweet$followers_count <- orgtweet$followers_count/100000
orgtweet$favourites_count <- orgtweet$favourites_count/100000
orgtweet$friends_count <- orgtweet$friends_count/100000
orgtweet$statuses_count <- orgtweet$statuses_count/100000
View(head(orgtweet[,41:52]))
summary(orgtweet$territory_lag_10)
tweet1 <- felm(religscore~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet2 <- felm(Imentionout~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet3 <- felm(religscore~Imentionout+territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
stargazer(list(tweet1, tweet2, tweet3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score_tweetlevel")
aggtweets <- orgtweet %>%
group_by(created_date) %>%
summarize(meanscore = mean(religscore, na.rm = TRUE),
territory = first(territory),
lagterritory = first(territory_lag_10),
totalevent1 = first(totalevent1),
daystoholi = first(daystoholi),
meanfollowers = mean(followers_count, na.rm = TRUE),
meanfavourites = mean(favourites_count, na.rm = TRUE),
meanfriends = mean(friends_count, na.rm = TRUE),
meanstatuses = mean(statuses_count, na.rm = TRUE),
meanaccountlength = mean(accountlength, na.rm = TRUE),
meanmedia = mean(media, na.rm = TRUE),
meanurls = mean(urls, na.rm = TRUE),
meanhashtags = mean(Ihashtags, na.rm = TRUE),
daily_active_user = first(daily_active_user),
daily_core_prop = first(daily_core_prop),
daily_herf = first(daily_herf),
ntweets = n())
agg.coord.coreprop1 <- lm(daily_core_prop ~ lagterritory + daystoholi, data = aggtweets)
agg.coord.geo1 <- lm(daily_herf ~ lagterritory + daystoholi, data = aggtweets)
org.relig.coreprop1 <- lm(meanscore ~ daily_core_prop + lagterritory + daystoholi, data = aggtweets)
org.relig.geo1 <- lm(meanscore ~ daily_herf + lagterritory + daystoholi, data = aggtweets)
texreg(list(agg.coord.coreprop1, org.relig.coreprop1, agg.coord.geo1, org.relig.geo1))
colnames(orgtweet)
# Generate variables about retweeting
orgtweet$perip_retweet <- orgtweet$members_retweet - orgtweet$core_retweet
orgtweet$core_perip <- orgtweet$core_retweet - orgtweet$perip_retweet
orgtweet$out_retweet <- orgtweet$all_retweet - orgtweet$members_retweet
orgtweet$memb_out <- orgtweet$members_retweet - orgtweet$out_retweet
orgtweet$memb_out_log <- ifelse(orgtweet$memb_out>0, log(orgtweet$memb_out),
ifelse(orgtweet$memb_out<0, -log(-orgtweet$memb_out), 0))
orgtweet$geo_noncore_retweet1 <- orgtweet$geo_retweet - orgtweet$geo_core_retweet1
orgtweet$geo_core1_noncore1 <- orgtweet$geo_core_retweet1 - orgtweet$geo_noncore_retweet1
orgtweet$memb_out <- orgtweet$memb_out*10
orgtweet$geo_core1_noncore1 <- orgtweet$geo_core1_noncore1*10
#######################################################################
##### This file replicates the first study (twitter) in the paper #####
#######################################################################
rm(list = ls())
library(data.table)
library(dplyr)
library(fixest)
library(lfe)
library(lmtest)
library(MASS)
library(plm)
library(sandwich)
library(stargazer)
library(texreg)
orgtweet <- fread("../datasets/1_twitter_tweets.csv", stringsAsFactors = FALSE)
## calculate variables
class(orgtweet$user_created_date)
orgtweet$accountlength <- as.Date("2015-12-31") - as.Date(orgtweet$user_created_date)
orgtweet$mentionout <- orgtweet$mentiontotal - orgtweet$mentionmember
orgtweet$Imentionout <- ifelse(orgtweet$mentionout >= 1, 1, 0)
orgtweet$Ihashtags <- ifelse(orgtweet$hashtags=="[]", 0, 1)
orgtweet$daily_core_prop <- orgtweet$daily_active_core/orgtweet$daily_active_user
### Appendix Table A8: Summary Statistics for Twitter Analyses
colnames(orgtweet)
# [1:6] is for removing the NA column
sumstats <- rbind(round(summary(orgtweet$religscore)[1:6], 3),
round(summary(orgtweet$territory_lag_10)[1:6], 3),
round(summary(orgtweet$daystoholi)[1:6], 3),
round(summary(orgtweet$followers_count)[1:6], 3),
round(summary(orgtweet$favourites_count)[1:6], 3),
round(summary(orgtweet$friends_count)[1:6], 3),
round(summary(orgtweet$statuses_count)[1:6], 3),
round(summary(as.numeric(orgtweet$accountlength))[1:6], 3),
round(summary(orgtweet$media)[1:6], 3),
round(summary(orgtweet$urls)[1:6], 3),
round(summary(orgtweet$Ihashtags)[1:6], 3))
row.names(sumstats) <- c("Religiosity Score", "Territory", "Days to Islamic Holidays", "Followers Count",
"Favorites Count", "Friends Count", "Statuses Count", "Account Length", "Media", "Urls", "Hashtags")
stargazer(sumstats, summary = FALSE)
### transform variables
orgtweet$daystoholi <- orgtweet$daystoholi/10000
orgtweet$accountlength <- orgtweet$accountlength/10000
orgtweet$followers_count <- orgtweet$followers_count/100000
orgtweet$favourites_count <- orgtweet$favourites_count/100000
orgtweet$friends_count <- orgtweet$friends_count/100000
orgtweet$statuses_count <- orgtweet$statuses_count/100000
tweet1 <- felm(religscore~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet2 <- felm(Imentionout~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet3 <- felm(religscore~Imentionout+territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
stargazer(list(tweet1, tweet2, tweet3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score_tweetlevel")
aggtweets <- orgtweet %>%
group_by(created_date) %>%
summarize(meanscore = mean(religscore, na.rm = TRUE),
territory = first(territory),
lagterritory = first(territory_lag_10),
totalevent1 = first(totalevent1),
daystoholi = first(daystoholi),
meanfollowers = mean(followers_count, na.rm = TRUE),
meanfavourites = mean(favourites_count, na.rm = TRUE),
meanfriends = mean(friends_count, na.rm = TRUE),
meanstatuses = mean(statuses_count, na.rm = TRUE),
meanaccountlength = mean(accountlength, na.rm = TRUE),
meanmedia = mean(media, na.rm = TRUE),
meanurls = mean(urls, na.rm = TRUE),
meanhashtags = mean(Ihashtags, na.rm = TRUE),
daily_active_user = first(daily_active_user),
daily_core_prop = first(daily_core_prop),
daily_herf = first(daily_herf),
ntweets = n())
agg.coord.coreprop1 <- lm(daily_core_prop ~ lagterritory + daystoholi, data = aggtweets)
length(aggtweets$lagterritory)
length(aggtweets$daystoholi)
View(aggtweets)
agg.coord.geo1 <- lm(daily_herf ~ lagterritory + daystoholi, data = aggtweets)
1+1
rm(list = ls())
library(data.table)
library(dplyr)
library(fixest)
library(lfe)
library(lmtest)
library(MASS)
library(plm)
library(sandwich)
library(stargazer)
library(texreg)
orgtweet <- fread("../datasets/1_twitter_tweets.csv", stringsAsFactors = FALSE)
## calculate variables
class(orgtweet$user_created_date)
orgtweet$accountlength <- as.Date("2015-12-31") - as.Date(orgtweet$user_created_date)
orgtweet$mentionout <- orgtweet$mentiontotal - orgtweet$mentionmember
orgtweet$Imentionout <- ifelse(orgtweet$mentionout >= 1, 1, 0)
orgtweet$Ihashtags <- ifelse(orgtweet$hashtags=="[]", 0, 1)
orgtweet$daily_core_prop <- orgtweet$daily_active_core/orgtweet$daily_active_user
### Appendix Table A8: Summary Statistics for Twitter Analyses
colnames(orgtweet)
# [1:6] is for removing the NA column
sumstats <- rbind(round(summary(orgtweet$religscore)[1:6], 3),
round(summary(orgtweet$territory_lag_10)[1:6], 3),
round(summary(orgtweet$daystoholi)[1:6], 3),
round(summary(orgtweet$followers_count)[1:6], 3),
round(summary(orgtweet$favourites_count)[1:6], 3),
round(summary(orgtweet$friends_count)[1:6], 3),
round(summary(orgtweet$statuses_count)[1:6], 3),
round(summary(as.numeric(orgtweet$accountlength))[1:6], 3),
round(summary(orgtweet$media)[1:6], 3),
round(summary(orgtweet$urls)[1:6], 3),
round(summary(orgtweet$Ihashtags)[1:6], 3))
row.names(sumstats) <- c("Religiosity Score", "Territory", "Days to Islamic Holidays", "Followers Count",
"Favorites Count", "Friends Count", "Statuses Count", "Account Length", "Media", "Urls", "Hashtags")
stargazer(sumstats, summary = FALSE)
### transform variables
orgtweet$daystoholi <- orgtweet$daystoholi/10000
orgtweet$accountlength <- orgtweet$accountlength/10000
orgtweet$followers_count <- orgtweet$followers_count/100000
orgtweet$favourites_count <- orgtweet$favourites_count/100000
orgtweet$friends_count <- orgtweet$friends_count/100000
orgtweet$statuses_count <- orgtweet$statuses_count/100000
tweet1 <- felm(religscore~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet2 <- felm(Imentionout~territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
tweet3 <- felm(religscore~Imentionout+territory_lag_10+daystoholi+followers_count+favourites_count+friends_count+
statuses_count+accountlength+media+urls+Ihashtags|0|0|user_id,
data = orgtweet)
stargazer(list(tweet1, tweet2, tweet3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score_tweetlevel")
aggtweets <- orgtweet %>%
group_by(created_date) %>%
summarize(meanscore = mean(religscore, na.rm = TRUE),
territory = first(territory),
lagterritory = first(territory_lag_10),
totalevent1 = first(totalevent1),
daystoholi = first(daystoholi),
meanfollowers = mean(followers_count, na.rm = TRUE),
meanfavourites = mean(favourites_count, na.rm = TRUE),
meanfriends = mean(friends_count, na.rm = TRUE),
meanstatuses = mean(statuses_count, na.rm = TRUE),
meanaccountlength = mean(accountlength, na.rm = TRUE),
meanmedia = mean(media, na.rm = TRUE),
meanurls = mean(urls, na.rm = TRUE),
meanhashtags = mean(Ihashtags, na.rm = TRUE),
daily_active_user = first(daily_active_user),
daily_core_prop = first(daily_core_prop),
daily_herf = first(daily_herf),
ntweets = n())
agg.coord.coreprop1 <- lm(daily_core_prop ~ lagterritory + daystoholi, data = aggtweets)
agg.coord.geo1 <- lm(daily_herf ~ lagterritory + daystoholi, data = aggtweets)
org.relig.coreprop1 <- lm(meanscore ~ daily_core_prop + lagterritory + daystoholi, data = aggtweets)
org.relig.geo1 <- lm(meanscore ~ daily_herf + lagterritory + daystoholi, data = aggtweets)
texreg(list(agg.coord.coreprop1, org.relig.coreprop1, agg.coord.geo1, org.relig.geo1))
# Generate variables about retweeting
orgtweet$perip_retweet <- orgtweet$members_retweet - orgtweet$core_retweet
orgtweet$core_perip <- orgtweet$core_retweet - orgtweet$perip_retweet
orgtweet$out_retweet <- orgtweet$all_retweet - orgtweet$members_retweet
orgtweet$memb_out <- orgtweet$members_retweet - orgtweet$out_retweet
orgtweet$geo_noncore_retweet1 <- orgtweet$geo_retweet - orgtweet$geo_core_retweet1
orgtweet$geo_core1_noncore1 <- orgtweet$geo_core_retweet1 - orgtweet$geo_noncore_retweet1
orgtweet$memb_out <- orgtweet$memb_out*10
orgtweet$geo_core1_noncore1 <- orgtweet$geo_core1_noncore1*10
# Aggregate data by user and date
panel <- orgtweet %>%
group_by(user_id, created_date) %>%
summarize(meanscore = mean(religscore, na.rm = TRUE),
territory = first(territory),
meanmention = mean(Imentionout, na.rm = TRUE),
totalevent1 = first(totalevent1),
daystoholi = first(daystoholi),
meanfollowers = mean(followers_count, na.rm = TRUE),
meanfavourites = mean(favourites_count, na.rm = TRUE),
meanfriends = mean(friends_count, na.rm = TRUE),
meanstatuses = mean(statuses_count, na.rm = TRUE),
meanaccountlength = mean(accountlength, na.rm = TRUE),
meanmedia = mean(media, na.rm = TRUE),
meanurls = mean(urls, na.rm = TRUE),
meanhashtags = mean(Ihashtags, na.rm = TRUE),
mean_core_perip = mean(core_perip, na.rm = TRUE),
mean_memb_out = mean(memb_out, na.rm = TRUE),
mean_geo_core1_noncore1 = mean(geo_core1_noncore1, na.rm = TRUE),
mean_members_retweet = mean(members_retweet, na.rm = TRUE),
mean_out_retweet = mean(out_retweet, na.rm = TRUE),
mean_core_retweet = mean(core_retweet, na.rm = TRUE),
mean_perip_retweet = mean(perip_retweet, na.rm = TRUE),
mean_geocore1_retweet = mean(geo_core_retweet1, na.rm = TRUE),
mean_geoperip1_retweet = mean(geo_noncore_retweet1, na.rm = TRUE),
daily_active_user = first(daily_active_user),
daily_core_prop = first(daily_core_prop),
daily_herf = first(daily_herf),
ntweets = n())
write.csv("../datasets/1_tweets_panel.csv", row.names = FALSE)
write.csv(panel, "../datasets/1_tweets_panel.csv", row.names = FALSE)
ppanel <- pdata.frame(panel)
ppanel$lagmeanscore <- lag(ppanel$meanscore, k=1, shift = "time")
ppanel$lagmeanmention <- lag(ppanel$meanmention, k=1, shift = "time")
ppanel$lagterritory <- lag(ppanel$territory, k=1, shift = "time")
ppanel$lagtotalevent1 <- lag(ppanel$totalevent1, k=1, shift = "time")
### Main Text Table 4: Group Power, Mobilization, and Religiosity Score
felm1 <- felm(meanscore~lagterritory+lagmeanscore+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm2 <- felm(meanmention~lagterritory+lagmeanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm3 <- felm(meanscore~lagterritory+lagmeanscore+meanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
stargazer(list(felm1, felm2, felm3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score")
# rescale territory
ppanel$territory <- ppanel$territory/100
ppanel$lagmeanscore <- lag(ppanel$meanscore, k=1, shift = "time")
ppanel$lagmeanmention <- lag(ppanel$meanmention, k=1, shift = "time")
ppanel$lagterritory <- lag(ppanel$territory, k=1, shift = "time")
ppanel$lagtotalevent1 <- lag(ppanel$totalevent1, k=1, shift = "time")
panel <- read.csv("../datasets/1_twitter_panel.csv", stringsAsFactors = FALSE)
ppanel <- pdata.frame(panel)
# rescale territory
ppanel$territory <- ppanel$territory/100
ppanel$lagmeanscore <- lag(ppanel$meanscore, k=1, shift = "time")
ppanel$lagmeanmention <- lag(ppanel$meanmention, k=1, shift = "time")
ppanel$lagterritory <- lag(ppanel$territory, k=1, shift = "time")
ppanel$lagtotalevent1 <- lag(ppanel$totalevent1, k=1, shift = "time")
### Main Text Table 4: Group Power, Mobilization, and Religiosity Score
felm1 <- felm(meanscore~lagterritory+lagmeanscore+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm2 <- felm(meanmention~lagterritory+lagmeanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm3 <- felm(meanscore~lagterritory+lagmeanscore+meanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
stargazer(list(felm1, felm2, felm3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score")
panel <- read.csv("../datasets/1_twitter_panel.csv", stringsAsFactors = FALSE)
colanmes(panel)
colnames(panel)
panel <- read.csv("../datasets/1_twitter_panel.csv", stringsAsFactors = FALSE)
ppanel <- pdata.frame(panel)
ppanel$lagmeanscore <- lag(ppanel$meanscore, k=1, shift = "time")
ppanel$lagmeanmention <- lag(ppanel$meanmention, k=1, shift = "time")
library(data.table)
library(dplyr)
library(fixest)
library(lfe)
library(lmtest)
library(MASS)
library(plm)
library(sandwich)
library(stargazer)
library(texreg)
ppanel <- pdata.frame(panel)
ppanel$lagmeanscore <- lag(ppanel$meanscore, k=1, shift = "time")
ppanel$lagmeanmention <- lag(ppanel$meanmention, k=1, shift = "time")
ppanel$lagterritory <- lag(ppanel$territory, k=1, shift = "time")
ppanel$lagtotalevent1 <- lag(ppanel$totalevent1, k=1, shift = "time")
### Main Text Table 4: Group Power, Mobilization, and Religiosity Score
felm1 <- felm(meanscore~lagterritory+lagmeanscore+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm2 <- felm(meanmention~lagterritory+lagmeanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
felm3 <- felm(meanscore~lagterritory+lagmeanscore+meanmention+daystoholi+meanfollowers+meanfavourites+
meanfriends+meanstatuses+meanmedia+meanurls+meanhashtags+meanaccountlength|0|0|user_id,
data = ppanel)
stargazer(list(felm1, felm2, felm3),
star.cutoffs=c(0.05, 0.01), no.space=TRUE, label="power_mob_score")
colnames(panel)
